const state = {
	product: {},
	num: '',
	sku: {},
	skuId: '',

	cartArray: [],
	cartProduct: [],

	cartNum: 0,

	//支付类型
	payWay: [],
}
const mutations = {
	chooseProduct(state, payload) {
		state.product = payload.product;
		state.num = payload.num;
		state.sku = payload.sku;
		state.skuId = payload.skuId;
	},
	chooseCart(state, payload) {
		state.cartArray = payload.cartArray;
		state.cartProduct = payload.cartProduct;
	},
	//修改购物车数量
	changeCartNum(state, payload) {
		state.cartNum = payload.cartNum;
	},
	//新增特殊支付类型
	addSpecialPay(state, payload) {

		state.payWay = [{
			pay_type: 2,
			pay_text: '微信支付',
		}, {
			pay_type: 3,
			pay_text: '积分余额',
		}]
		if (payload !== null) {
			const isHas = state.payWay.find(item => {
				return item.pay_type === payload[0]
			})
			if (!isHas) {
				state.payWay.push({
					pay_type: payload[0],
					pay_text: payload[1],
				})
			}
		}
		
	},



}


export default {
	state,
	mutations
}